package com.portalEsporteClubeBahia.app.vo;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class NewsVO implements Serializable{
	
	public NewsVO(){
		typeNews = new TypeNewsVO();
		active = true;
	}

	private static final long serialVersionUID = -7069780720723518906L;

	private Long id;
	
	private TypeNewsVO typeNews;
	
	private String title;
	
	private Date date;
	
	private Date dateEnds;
	
	private String urlImage;
	
	private String content;
	
	private String shortContent;
	
	private Boolean active;
	
	private String urlWebSite;
	
	private Integer ranking;
	
	private String dateString;
	
	private String dateStringStarts;
	
	private String dateStringEnds;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public TypeNewsVO getTypeNews() {
		return typeNews;
	}

	public void setTypeNews(TypeNewsVO typeNews) {
		this.typeNews = typeNews;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
		
		if(date!=null){
			SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
			this.setDateString(sdf.format(this.date));
		}
	}

	public String getUrlImage() {
		return urlImage;
	}

	public void setUrlImage(String urlImage) {
		this.urlImage = urlImage;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getShortContent() {
		return shortContent;
	}

	public void setShortContent(String shortContent) {
		this.shortContent = shortContent;
	}

	public Boolean getActive() {
		return active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	public String getUrlWebSite() {
		return urlWebSite;
	}

	public void setUrlWebSite(String urlWebSite) {
		this.urlWebSite = urlWebSite;
	}
	
	public String getDateFormat(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm");
		try{
			return sdf.format(date);
		}catch(Exception e){
			return "";
		}
	}

	public Integer getRanking() {
		return ranking;
	}

	public void setRanking(Integer ranking) {
		this.ranking = ranking;
	}

	public String getDateString() {
		return dateString;
	}

	public void setDateString(String dateString) {
		this.dateString = dateString;
	}

	public Date getDateEnds() {
		return dateEnds;
	}

	public void setDateEnds(Date dateEnds) {
		this.dateEnds = dateEnds;
	}

	public String getDateStringStarts() {
		return dateStringStarts;
	}

	public void setDateStringStarts(String dateStringStarts) {
		this.dateStringStarts = dateStringStarts;
	}

	public String getDateStringEnds() {
		return dateStringEnds;
	}

	public void setDateStringEnds(String dateStringEnds) {
		this.dateStringEnds = dateStringEnds;
	}
	
	public String getDateStringStartsFormat(){
		try{
			String date = "";
			String[] array = this.dateStringStarts.split("/");
			date = array[2]+"-"+array[1]+"-"+array[0];
			
			return date;
		}catch(Exception e){
			return null;
		}
	}
	
	public String getDateStringEndsFormat(){
		try{
			String date = "";
			String[] array = this.dateStringEnds.split("/");
			date = array[2]+"-"+array[1]+"-"+array[0];
			
			return date;
		}catch(Exception e){
			return null;
		}
	}

}
